/********************************************************************
	filename: 	Triangle2D.h
	created:	2010/04/20
	author:		Xiuwei Chen

	purpose:	Definition of class 2D Triangle

	All rights Reserved
*********************************************************************/

#pragma once

#include "Const.h"
#include "Vector2D.h"

class Triangle2D
{
public:
	/// <Summary>
	/// Zero of 2D triangle
	/// </Summary>
	const static Triangle2D Zero;

	/// <Summary>
	/// vertex of triangle
	/// </Summary>
	Point2D p0, p1, p2;

	/// <Summary>
	/// default constructor
	/// </Summary>
	Triangle2D();

	/// <Summary>
	/// copy constructor
	/// </Summary>
	Triangle2D(const Triangle2D &triangle);

	/// <Summary>
	/// constructor
	/// </Summary>
	Triangle2D(const Point2D &_p0, const Point2D &_p1, const Point2D &_p2);

	/// <Summary>
	/// constructor
	/// </Summary>
	Triangle2D(Point2D *p);

	/// <Summary>
	/// constructor
	/// </Summary>
	Triangle2D(double x0, double y0, double x1, double y1, double x2, double y2);

	/// <Summary>
	/// set value
	/// </Summary>
	void SetValue(const Point2D &_p0, const Point2D &_p1, const Point2D &_p2);

	/// <Summary>
	/// set value
	/// </Summary>
	void SetValue(Point2D *p);

	/// <Summary>
	/// set value
	/// </Summary>
	void SetValue(double x0, double y0, double x1, double y1, double x2, double y2);

	/// <Summary>
	/// overload operation: assignment
	/// </Summary>
	Triangle2D & operator = (const Triangle2D &t);

	/// <Summary>
	/// overload operation: "=="
	/// </Summary>
	bool operator == (const Triangle2D &t) const;

	/// <Summary>
	/// overload operation: "!="
	/// </Summary>
	bool operator != (const Triangle2D &t) const;

	/// <Summary>
	/// Translation by 2D vector
	/// </Summary>
	void Translation(const Vector2D &v);

	/// <Summary>
	/// rotate counter clockwise around a point (radian)
	/// </Summary>
	void Rotation(const Point2D &center, double angle);

	/// <Summary>
	/// Area of 2D Triangle
	/// </Summary>
	double Area() const;

	/// <Summary>
	/// Oriented area of 2D Triangle
	/// </Summary>
	double AreaOriented() const;

	/// <Summary>
	/// center of excircle
	/// </Summary>
	Point2D ExcircleCenter() const;

	/// <Summary>
	/// center of incircle
	/// </Summary>
	Point2D IncircleCenter() const;

	/// <Summary>
	/// radius of excircle
	/// </Summary>
	double ExcircleRadius() const;

	/// <Summary>
	/// radius of incircle
	/// </Summary>
	double IncircleRadius() const;
};
